<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="../common.inc" %>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link href="./css/style1.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="./js/form.js"></script>
<script type="text/javascript" language="javascript">
<!--
	function checkForm(){
		var objs = document.getElementsByName("id");
		var sign = 0;
		for(var i = 0; i < objs.length; i++){
			if(objs[i].value != 0 && objs[i].checked)sign = sign + 1;
		}
		if(sign <= 0){
			alert("<fmt:message key='myRecycle.message.select'/>");
			return false;
		}
		return true;
	}

	function pageCustomer(flag){
		document.discardCustomerForm.action = "./myRecycleBin.do?action=display&flag="+flag;
		document.discardCustomerForm.target = "main";
		document.discardCustomerForm.submit();
	}
	
	function searchCustomer(){
		var customerName = document.getElementById("customerName");
		if(customerName.value == ""){
			alert("<fmt:message key='openSea.message.search'/>");
		}else{
			document.getElementById("sFlag").value = "1";
			document.discardCustomerForm.action = "./myRecycleBin.do";
			document.discardCustomerForm.target = "main";
			document.discardCustomerForm.submit();
		}
	}
	
	function againPickUpCustomer(){
		if(checkForm()){
			document.discardCustomerForm.action = "./myRecycleBin.do?action=againPickUpCustomer";
			document.discardCustomerForm.target = "main";
			document.discardCustomerForm.submit();
		}
	}
	
	function turnToOpenCustomer(){
		if(checkForm()){
			document.discardCustomerForm.action = "./myRecycleBin.do?action=turnToOpenCustomer";
			document.discardCustomerForm.target = "main";
			document.discardCustomerForm.submit();
		}
	}
	
	function deleteCustomer(){
		if(checkForm()){
			document.discardCustomerForm.action = "./myRecycleBin.do?action=deleteCustomer";
			document.discardCustomerForm.target = "main";
			document.discardCustomerForm.submit();
		}
	}
	
	function initPage(){
		if("<c:out value='${againResult}'/>" == 1){
			alert("<fmt:message key='myRecycle.message.pickup'/>");
		}
		if("<c:out value='${turnResult}'/>" == 1){
			alert("<fmt:message key='myRecycle.message.opensea'/>");
		}
		if("<c:out value='${deleteResult}'/>" == 1){
			alert("<fmt:message key='common.message.deleteSuccess'/>");
		}
	}
-->
</script>
</head>
<body onload="initPage()">
<form name="discardCustomerForm" action="" method="post">
	<table class="table_frame">
		<tr>
			<td>
				<table class="table_title1">
					<tr>
						<td class="title_lab" colspan="2">我的回收站</td>
					</tr>
					<tr>
						<td valign="bottom" class="a_tools" style="padding-left: 3px;"><fmt:message key='openSea.lable.search'/>
							<input id="customerName" name="customerName" class="input_query" type="text" value="${customerName}"/>
							<input id="sFlag" name="sFlag" type="hidden" value="${sFlag}"/>
							<a class="search" href="javascript:searchCustomer();" target="main" hidefocus="true">查询</a>
							|
							<c:if test="${isAgainPickUp == 1}">
							<a class="pickup" href="javascript:againPickUpCustomer();" hidefocus="true"><fmt:message key='myRecycle.button.pickup'/></a>
							</c:if>
							<c:if test="${isUseCommon > 0 && isTurnToOpenSea == 1 && isExceptionPool != 1}">
							<a class="moveopen" href="javascript:turnToOpenCustomer();" hidefocus="true"><fmt:message key='myRecycle.button.opensea'/></a>
							</c:if>
							<c:if test="${isDeleteRecycleBin == 1}">
							<a class="del" href="javascript:deleteCustomer();" hidefocus="true"><fmt:message key='common.button.delete'/></a>
							</c:if>
						</td>
						<td></td>
					</tr>
					<tr><td colspan="2" height="2"></td></tr>
				</table>
			</td>
		</tr>
		<tr>
			<td>
				<table class="table_title2">
					<tr>
						<td class="title_lab">我丢弃的客户</td>
						<td align="right" valign="">
							<!-- page -->
							<table class="table_page2">
								<tr>
									<td valign="bottom">
										<img src="./images/frist.bmp" onclick="pageCustomer(1)" alt="首页" style="vertical-align: middle;cursor: hand;">
										<img src="./images/last.bmp" onclick="pageCustomer(2)" alt="上一页" style="vertical-align: middle;cursor: hand;">&nbsp;
										<font color="red">${currentPage}</font>/${totalPages}&nbsp;<fmt:message key='common.page'/>&nbsp;
										<img src="./images/next.bmp" onclick="pageCustomer(3)" alt="下一页" style="vertical-align: middle;cursor: hand;">
										<img src="./images/end.bmp" onclick="pageCustomer(4)" alt="末页" style="vertical-align: middle;cursor: hand;">
										共&nbsp;&nbsp;${totalRows}&nbsp;<fmt:message key='common.page.totalRow'/>&nbsp;&nbsp;&nbsp;
									</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr><td colspan="3" height="2"></td></tr>
					<tr>
						<td colspan="2">
							<table class="table">
								<tr>
									<td valign="top">
										<!-- 
										<div style="width:800px;height:100%;overflow-x: scroll;overflow-y: hidden;">
										 -->
										<table class="table_style" style="width: 1300px;  word-break:break-all"">
											<tr>
												<td class="title" width="8"></td>
												<td class="title" width="30">
													选择
												</td>
												<td class="title" width="300"><fmt:message key='customer.lable.customerName'/></td>
												<td class="title" width="60">销售代表</td>
												<td class="title" width="70">建档日期</td>
												<td class="title" width="70"><fmt:message key='customer.lable.lastlink'/></td>
												<td class="title" width="130">注册地址</td>
												<td class="title" width="300">销售进度</td>																								
												<td class="title" width="60"><fmt:message key='myRecycle.lable.saleStage'/></td>
												<td class="title" width="60"><fmt:message key='myRecycle.lable.historyCost'/></td>
											</tr>
											<c:forEach var="customer" items="${customers}">
											<tr onmouseover="onmousemoveChange(this,'img${customer.id}')" onmouseout="onmouseoutChange(this,'img${customer.id}')">
												<td height="16" width="8" align="right"><img id="img${customer.id}" src="./images/table_sign2.bmp"></td>
												<td><input id="id" name="id" type="checkbox" value="${customer.id}"/></td>
												<td align="left"><a href="./customerManage.do?action=customerDetail&customerId=${customer.id}&sign=101" target="main">${customer.customerName}</a></td>
												<td>${customer.salePerson}</td>
												<td><fmt:formatDate value="${customer.createDate}" pattern="yyyy-MM-dd"/></td>
												<td><fmt:formatDate value="${customer.lastLink}" pattern="yyyy-MM-dd"/></td>
												<td>${customer.summaryAddress}</td>
												<td>${customer.customItem2}</td>
												<td>
													${customer.saleStage}
													<font color="red">
													<c:choose>
														<c:when test="${customer.saleStatus == '1'}">[挂起]</c:when>
														<c:when test="${customer.saleStatus == '4'}">[关闭商机]</c:when>
													</c:choose>
													</font>
												</td>
												<td>${customer.historyContractCost}</td>
											</tr>
											</c:forEach>
										</table>
										<!-- 
										</div>
										 -->
									</td>
								</tr>
								<tr>
									<td align="left" valign="bottom">
										<!-- page -->
										<table id="tp" class="table_page">
											<tr>
												<td>&nbsp;&nbsp;
													<img src="./images/frist.bmp" onclick="pageCustomer(1)" alt="首页" style="vertical-align: middle;cursor: hand;">
													<img src="./images/last.bmp" onclick="pageCustomer(2)" alt="上一页" style="vertical-align: middle;cursor: hand;">&nbsp;
													<font color="red">${currentPage}</font>/${totalPages}&nbsp;<fmt:message key='common.page'/>&nbsp;
													<img src="./images/next.bmp" onclick="pageCustomer(3)" alt="下一页" style="vertical-align: middle;cursor: hand;">
													<img src="./images/end.bmp" onclick="pageCustomer(4)" alt="末页" style="vertical-align: middle;cursor: hand;">
													共&nbsp;&nbsp;${totalRows}&nbsp;<fmt:message key='common.page.totalRow'/>
												</td>
											</tr>
										</table>
									</td>
								</tr>
							</table>
						</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
</form>
</body>
</html>